package recursion.leetcode.editor.cn;


import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class HanotaLcci {
    public static void main(String[] args) {
        Solution solution = new HanotaLcci().new Solution();
        solution.hanota(new ArrayList<>(Arrays.asList(1,0)), new ArrayList<>(),new ArrayList<>());
    }

    //leetcode submit region begin(Prohibit modification and deletion)
    class Solution {
        public void hanota(List<Integer> A, List<Integer> B, List<Integer> C) {
            move(A, B, C, A.size());
        }

        private void move(List<Integer> a, List<Integer> b, List<Integer> c, int n) {
            if (n == 1) {
                c.add(a.remove(a.size() - 1));
                return;
            }

            move(a, c, b, n - 1);
            c.add(a.remove(a.size() - 1));
            move(b, a, c, n - 1);
        }
    }
//leetcode submit region end(Prohibit modification and deletion)

}